package com.doone.telmarket.action.admin;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

public abstract class BaseActionSupport extends ActionSupport implements SessionAware, ServletRequestAware,
		ServletResponseAware {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	protected HttpServletRequest servletRequest;

	protected HttpServletResponse servletResponse;

	protected Map<String, Object> session;

	@SuppressWarnings("unchecked")
	public void setSession(Map arg0) {
		session = arg0;
	}

	public void setServletRequest(HttpServletRequest arg0) {
		servletRequest = arg0;

	}

	public void setServletResponse(HttpServletResponse arg0) {
		servletResponse = arg0;
	}

	protected void responseWrite(String string) throws IOException {

		servletResponse.setContentType("text/json;charset=utf-8");
		servletResponse.setCharacterEncoding("UTF-8");
		PrintWriter out = servletResponse.getWriter();
		LOG.debug("===responseWritePageGrid==" + string);
		out.print(string);
	}

}
